//
//  NSMutableArray+Move.m
//  CarTown
//
//  Created by xionghao on 15/9/11.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "NSMutableArray+Move.h"

@implementation NSMutableArray (Move)
- (void)moveObjectFromIndex:(NSUInteger)fromIndex toIndex:(NSUInteger)toIndex
{
    　　if (toIndex != fromIndex && fromIndex < [self count] && toIndex< [self count]) {
        id obj = [self objectAtIndex:fromIndex];
       
        [self removeObjectAtIndex:fromIndex];
        if (toIndex >= [self count]) {
            [self addObject:obj];
        } else {
            [self insertObject:obj atIndex:toIndex];
        }
        
    }
}
@end
